package com.happy016.controller;

import com.happy016.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.List;

/**
 * SpringBoot 1.5.6.RELEASE
 *  默认thymeleaf是2.1.5.RELEASE版本的,这个版本html效验很好,比如 <input> 少个/结尾都会报错,可以引入自己的thymeleaf版本
 * @author Linyb
 * create on 2017/8/26 10:41
 */
@Controller
public class UserController {

    @RequestMapping(value = "",method = RequestMethod.GET)
    public String index(Model model){
        List<User> list = new ArrayList<>();
        for(int i = 1 ;i <= 5 ;i++){
            list.add(new User(i,"username_"+i,i));
        }
        model.addAttribute("list",list);
        return "list";
    }
}
